<?php

	$changes = $_REQUEST['changes'];
	try {
		$db = new PDO('sqlite:voc.sqlite3');
		$all = 0;
		foreach ( $changes as $c ) {
			$sql="UPDATE bgvoc SET Marked=$c[2] WHERE Grp=$c[0] AND Num=$c[1];";
			$q = $db->query($sql);
			if (isset($q)) {
				$all += count($q);
			}
		}
		$str = "$all marks changed.";
		if ($all < 2) {
			$str = "$all mark changed.";
		}
		print( $str );
		$db = null;
	} catch (PDOException $e) {
	    print "Error!: " . $e->getMessage();
	    die();
	}
?>

